/**
 * Created by zhengjiachao on 2017/4/16.
 */

BCP.bill.propertyDescriptor.BiztypePropertyDescriptor = function(name, value, defaultValue, editable, title, hint){
    BCP.bill.propertyDescriptor.BiztypePropertyDescriptor.superclass.constructor.call(this, name, value, defaultValue, editable, title, hint);
    this.setAdditional("bcp.biz.Biztype");
    this.setEditorType("baseProperty.metadataEditor");
};

COM.util.defineClass(BCP.bill.propertyDescriptor.BiztypePropertyDescriptor, ADF.propertyDescriptor.DefaultPropertyDescriptor,{

    setValue : function(value){
        BCP.bill.propertyDescriptor.BiztypePropertyDescriptor.superclass.setValue.call(this, value);
        this._setWindowBinding();
    },

    _setWindowBinding : function(){
        if(window.semantic_object_manager){
            semantic_object_manager.findSemanticObject(this.getValue()).then(function (semanticObject) {
                semantic_object_manager.findSemanticObject(semanticObject.type, {
                        loadParentAtt: true
                    }).then(function (semanticObject1) {
                    window.BCP.bill._bindings_.kclass = semanticObject1;
                }).catch(function (e) {
                    console.error(e);
                });
            }).catch(function (e) {
                console.error(e);
            });
        }
        
    },

    deserialize: function(jsonString){
        BCP.bill.propertyDescriptor.BiztypePropertyDescriptor.superclass.deserialize.call(this, jsonString);
        this._setWindowBinding();
    }
    
});